<?php
session_start();
include(dirname(dirname(dirname(__FILE__)))."/functions/inc/util.inc.php");
include(dirname(dirname(dirname(__FILE__)))."/functions/inc/mydb.inc.php");
include(dirname(dirname(dirname(__FILE__)))."/functions/inc/seguridad.php");
include(dirname(dirname(dirname(__FILE__)))."/entidades/service.class.php");


$db = new mydb();
if(is_numeric($_POST["id"]))
$service = new service($_POST["id"]);

//die(print_r($_POST));

if(trim($_POST["descripcion"])!="" && trim($_POST["kilometros"])!=""){
$service->setserv_descripcion(addslashes($_POST["descripcion"]));
$service->setserv_kilometros(addslashes($_POST["kilometros"]));
$service->upd();
    if(isset($_POST["page"]))
    header("Location:/index.php?acc=41&id_moto=".$_POST["moto_id"]."&msg=4&id={$_POST["id"]}&page={$_POST["page"]}");
    else
      header("Location:/index.php?acc=41&id_moto=".$_POST["moto_id"]."&msg=4&id={$_POST["id"]}");  
    die();
}
else
{
     if(isset($_POST["page"]))
    header("Location:/index.php?acc=41&msg=2&id={$_POST["id"]}&page={$_POST["page"]}&id_moto={$_POST["moto_id"]}");
    else
      header("Location:/index.php?acc=41&msg=2&id={$_POST["id"]}&id_moto={$_POST["moto_id"]}");  
    die();
}
?>
